using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EZCRS.HCMS.DataAcl;
using EZCRS.HCMS.Bll.userinfo;
using EZCRS.HCMS.Web;

namespace EZCRS.HCMS.Web.manage.carduser
{
    public partial class cardnumb_nouse : ManageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(EZCRS.HCMS.myajax.CardUserUtils));
            if (!Page.IsPostBack)
            {
                Titlepage1.initlabnew = "<a href=\"cardnumb_add.aspx\"><img src=\"../../Themes/Standard/Images/new.gif\" border=0></a> ";
            }
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            DataTable dt = getData();
            CFun.CreateTXT(dt, "cardnumber.txt");
        }

        protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
        {
            DataTable dt = getData();
            CFun.CreateEXCEL(dt, "cardnumber.xls");
        }

        private DataTable getData()
        {
            string Strwhere = "";
            if (searchno.Value.Trim() != "")
            {
                Strwhere += " and cardnumber like '%" + searchno.Value.Trim().Replace("'", "") + "%'";
            }
            Strwhere += " and orgid = " + BasGroupId + " and (uid is null or uid='')";
            // Strwhere += " and orgtype = " + CurrentOrgType;

            Bllcardinfo ACN = new Bllcardinfo();
            return ACN.CardNumb_List(Strwhere, "");
        }
    }
}
